package Demo1;
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

public class Main{
    public static void main(String[] agrs){
        List <Person> hands = new ArrayList();

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        for (int i = 0; i < n; i++){
            String name = scanner.next();
            int age = scanner.nextInt();
            boolean gender = scanner.nextBoolean();
            Person person = new Person(name, age, gender);
            hands.add(person);
        }

        for (int i = n - 1; i >= 0; i--){
            System.out.println(hands.get(i));
        }


        System.out.println(new Person());
    }
}